// /**
//  * Copyright © Magento, Inc. All rights reserved.
//  * See COPYING.txt for license details.
//  */

//
//  Variables
//  _____________________________________________

@review-ratings-left: 280px;

//
//  Common
//  _____________________________________________

& when (@media-common = true) {

    .data.switch .counter {
        .lib-css(color, @text__color__muted);

        &:before {
            content: '(';
        }

        &:after {
            content: ')';
        }
    }

    .rating-summary {
        .lib-rating-summary();
    }

    .product-reviews-summary,
    .table-reviews {
        .rating-summary {
            .lib-rating-summary-label-hide();
        }
    }

    .review-control-vote {
        .lib-rating-vote();

        &:before {
            .lib-rating-icons-content(
                @_icon-content: @icon-star-empty
            );
        }
    }

    //
    //  Account Review list page
    //  -----------------------------------------

    .products-reviews-toolbar {
        position: relative;

        .toolbar-amount {
            position: relative;
            text-align: center;
        }
    }

    //
    //  Review product page
    //  -----------------------------------------

    .review {
        &-toolbar {
            border-top: 1px solid @color-gray79;
            margin: 0 0 @indent__base;
            padding: 0;
            text-align: center;

            &:first-child {
                display: none;
            }

            .pages {
                border-bottom: 1px solid @color-gray79;
                display: block;
                padding: @indent__base 0;
                text-align: center;
            }

            .limiter {
                display: none;
            }
        }

        &-add {
            .block-title {
                display: none;
            }
        }

        &-form {
            .action.submit.primary {
                .lib-button-revert-secondary-color();
                .lib-button-revert-secondary-size();
                margin: 0;
            }

            .actions-toolbar .actions-primary {
                padding: 0;
            }
        }

        .fieldset &-legend.legend {
            border-bottom: 0;
            line-height: 1.3;
            margin-bottom: @indent__base;
            padding: 0;

            span {
                margin: 0;
            }

            strong {
                display: block;
                font-weight: 600;
            }
        }

        .fieldset &-field-ratings {
            > .label {
                font-weight: 600;
                margin-bottom: @indent__s;
                padding: 0;
            }
        }

        &-control-vote label:before,
        &-control-vote:before {
            font-size: 32px;
            height: 32px;
            letter-spacing: 10px;
            line-height: 32px;
        }

        &-field-rating {
            .label {
                font-weight: 600;
            }

            .control {
                margin-bottom: 1.2*@indent__xl;
                margin-top: @indent__s;
            }
        }

        &-list {
            margin-bottom: @indent__l;

            .block-title {
                strong {
                    .lib-heading(h2);
                }
            }
        }

        &-item {
            .lib-clearer();
            border-bottom: 1px solid @color-gray79;
            margin: 0;
            padding: @indent__base 0;

            &:last-child {
                border-width: 0;
            }
        }

        &-ratings {
            display: table;
            margin-bottom: @indent__s;
            max-width: 100%;
            &:extend(.abs-rating-summary all);
        }

        &-author {
            display: inline;

            .review-details-value {
                font-weight: 400;
            }
        }

        &-date {
            display: inline;

            .review-details-label {
                &:extend(.abs-visually-hidden all);
            }
        }

        &-title {
            .lib-heading(h3);
            margin: 0 0 @indent__base;
        }

        &-content {
            margin-bottom: @indent__base;
        }
    }

    .page-main {
        .column {
            .review-add {
                margin-bottom: 0;
            }
        }
    }
}

//
//  Desktop
//  _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__s) {
    .review {
        &-form {
            max-width: 500px;
        }

        &-ratings {
            float: left;
            margin-bottom: 0;
            max-width: @review-ratings-left - @indent__xl;
        }

        &-ratings ~ &-content,
        &-ratings ~ &-details {
            margin-left: @review-ratings-left;
        }
    }

    .review {
        @reviews-indent-desktop: 30px;

        &-toolbar {
            margin: 0 0 @reviews-indent-desktop;

            .pages {
                padding: @reviews-indent-desktop 0;
            }
        }

        .fieldset &-legend.legend {
            margin-bottom: @reviews-indent-desktop;
        }

        &-item {
            padding: @reviews-indent-desktop 0;
        }

        &-title {
            margin: 0 0 @reviews-indent-desktop;
        }
    }
}

//
//  Common
//  _____________________________________________

& when (@media-common = true) {
    .data.table.reviews {
        .rating-summary {
            margin-top: -4px;
        }
    }

    .customer.review.view {
        .review.title,
        .ratings.summary.items,
        .product.details {
            margin-bottom: @indent__base;
        }
    }

    .product-reviews-summary {
        margin-bottom: @indent__xs;

        .products.wrapper.list & {
            margin: 0 auto;
        }

        .rating-summary {
            display: inline-block;
            vertical-align: middle;
        }

        .reviews-actions {
            display: inline-block;
            font-size: floor(.8 * @font-size__base);
            vertical-align: middle;

            a:not(:last-child) {
                margin-right: 30px;
            }
        }
    }

    .product-info-main,
    .customer-review {
        .rating-summary {
            margin-right: 30px;
        }
    }
}

//
//  Desktop
//  _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
    .product-reviews-summary {
        margin-bottom: @indent__s + @indent__xs;

        .products.wrapper.list & {
            margin: 0;
        }

        .reviews-actions {
            font-size: @font-size__base;
            margin-top: 3px;
        }
    }
}

//
//  Common
//  _____________________________________________

& when (@media-common = true) {

    //
    //  Account
    //  -----------------------------------------

    .block-reviews-dashboard {
        .items {
            .item {
                .lib-css(margin-bottom, @indent__base);

                &:last-child {
                    margin-bottom: 0;
                }
            }
        }

        .product-name {
            display: inline-block;

            &:not(:last-child) {
                .lib-css(margin-bottom, @indent__xs);
            }
        }

        .rating-summary {
            .label {
                .lib-css(font-weight, @font-weight__semibold);
                .lib-css(margin-right, @indent__s);
            }
        }
    }

    .table-reviews,
    .block-reviews-dashboard {
        .product-name {
            .lib-css(font-weight, @font-weight__regular);
        }
    }

    .table-reviews {
        .rating-summary {
            display: inline-block;
            vertical-align: baseline;
        }
    }
}

//
//  Mobile
//  _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__s) {
    .account {
        .table-reviews {
            .col.actions {
                &:extend(.abs-col-no-prefix all);
            }
        }
    }
}

//
//  Desktop
//  _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
    .block-reviews-dashboard {
        .product-name {
            &:extend(.abs-account-block-font-size all);
        }
    }
}

//
//  Common
//  _____________________________________________

& when (@media-common = true) {

    .customer-review {
        .product-details {
            &:extend(.abs-add-clearfix all);
            &:extend(.abs-margin-for-blocks-and-widgets all);
            .rating-average-label {
                &:extend(.abs-visually-hidden all);
            }
        }

        .product-media {
            float: left;
            margin-right: 3%;
            max-width: 285px;
            width: 30%;
        }

        .review-details {
            margin: 0;

            .title {
                &:extend(.abs-account-title all);
            }

            .customer-review-rating {
                .lib-css(margin-bottom, @indent__base);
                .item {
                    .lib-css(margin-bottom, @indent__s);

                    &:last-child {
                        margin-bottom: 0;
                    }
                }

                &:extend(.abs-rating-summary all);
            }

            .review-title {
                .lib-heading(h3);
                .lib-css(font-weight, @font-weight__semibold);
                .lib-css(margin-bottom, @indent__base);
            }

            .review-content {
                margin: 0;
                .lib-css(margin-bottom, @indent__base);
            }

            .review-date {
                .lib-css(color, @primary__color__light);
            }
        }
    }
}

//
//  Mobile
//  _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__s) {
    .customer-review {
        .product-name {
            .lib-css(margin-bottom, @indent__xs);
        }

        .product-reviews-summary {
            .rating-summary {
                display: block;
                .lib-css(margin-bottom, @indent__xs);
            }
        }
    }
}

//
//  Desktop
//  _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
    .customer-review {
        .product-details {
            &:extend(.abs-margin-for-blocks-and-widgets-desktop all);
        }
    }
}
